<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>Insert title here</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>Hello, Bootstrap Table!</title>
    <!-- 最新 Bootstrap4 核心 CSS 文件 -->
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.4.1/css/bootstrap.min.css">

    <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
    <script src="https://cdn.staticfile.org/jquery/3.4.1/jquery.min.js"></script>
    <!-- bootstrap.bundle.min.js 用于弹窗、提示、下拉菜单，包含了 popper.min.js -->
    <script src="https://cdn.staticfile.org/popper.js/1.16.0/umd/popper.min.js"></script>
    <!-- 最新的 Bootstrap4 核心 JavaScript 文件 -->
    <script src="https://cdn.staticfile.org/twitter-bootstrap/4.4.1/js/bootstrap.min.js"></script>
    <!-- DaterangePicker -->
    <link rel="stylesheet" type="text/css" media="all" th:href="@{/daterangepicker/daterangepicker.css}"/>
    <!-- BootStrapValidator -->
    <link rel="stylesheet"
          href="https://cdn.bootcss.com/jquery.bootstrapvalidator/0.5.3/css/bootstrapValidator.min.css">
    <script type="text/javascript"
            src="https://cdn.bootcss.com/jquery.bootstrapvalidator/0.5.3/js/bootstrapValidator.min.js"></script>
    <script th:src="@{/js/functions.js}"></script>
</head>
<body style="margin: 200px">
<div class="container-fluid" >
    <hr>
    <div class="row">
        <div class="col-md-12">
            <form class="form-inline" role="form" id="searchForm" th:method="post" th:action="@{/user/getUserList}">
                <div class="form-group col-md-2 offset-1">
                    <input class="form-control input-sm" type="text" id="username" name="username" placeholder="用户名"
                    th:value="${param.username}"/>
                </div>
                <div class="form-group col-md-2">
                    <select class="form-control input-sm" id="gender" name="gender" >
                        <option value="">---不限制性别---</option>
                        <option value="1" th:selected="${#strings.trim(param.gender)=='1'}">男</option>
                        <option value="0" th:selected="${#strings.trim(param.gender)=='0'}">女</option>
                    </select>
                </div>
                <div class="form-group col-md-1">
                    <button class="btn btn-primary btn-sm" type="submit" >搜索</button>
                </div>
            </form>
        </div>
    </div>
    <hr>
    <div class="row">
        <div class="col-md-12" >
            <table class="table table-bordered">
                <thead>
                <tr>
                    <th>序号</th>
                    <th>用户名</th>
                    <th>真名</th>
                    <th>生日</th>
                    <th>性别</th>
                    <th>兴趣爱好</th>
                    <th>学历</th>
                    <th>自我介绍</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <tr th:each="user,stat:${userList}">
                    <td th:text="${stat.count}">1</td>
                    <td th:text="${user.username}">Tanmay</td>
                    <td th:text="${user.realname}">王二狗</td>
                    <td th:text="${user.birthdate}">2000-09-27</td>
                    <td th:text="${user.gender == '1'?'男':'女'}"> 1</td>
                    <td th:text="${user.interest}">读书</td>
                    <td th:switch="${user.degree}">
                        <span th:case="'0'">高中</span>
                        <span th:case="'1'">专科</span>
                        <span th:case="'2'">本科</span>
                    </td>
                    <td th:text="${user.intro}">本人积极向上</td>
                    <td>
                        <a  th:href="@{/user/getUser(userid=${user.userid})}">修改</a>
                        <a  href="#">删除</a>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>
    <hr>
    <div class="row">
        <div class="col-md-12">
            <div class="text-center">
                <a type="button" class="btn btn-outline-info" th:href="@{/}">返回首页</a>
            </div>
        </div>
    </div>
</div>
</body>
</html>